﻿using _11.外观模式.Hardware;
using _11.外观模式.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _11.外观模式.Facade
{
    public class Computer : IComputer
    {
        private BIOS bios = null;
        private CPU cpu = null;
        private HardDisk hardDisk = null;
        private Memory memory = null;
        private OS os = null;
        private Desktop desktop = null;
        public void PowerOn()
        {
            Console.WriteLine("电脑开机...");
            bios?.SelfCheck();
            cpu?.Run();
            hardDisk?.LoadMBR();
            memory?.Run();
            os?.Load();
            desktop?.Display();
        }

        public void SetBIOS(BIOS bios) => this.bios = bios;
        public void SetCPU(CPU cpu) => this.cpu = cpu;
        public void SetHardDisk(HardDisk hardDisk) => this.hardDisk = hardDisk;
        public void SetMemory(Memory memory) => this.memory = memory;
        public void SetOS(OS os) => this.os = os;
        public void SetDesktop(Desktop desktop) => this.desktop = desktop;
    }
}
